/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author FIRE
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { TreeDataModel, TreeModel } from '../model/baseModel';

const { adminPath } = useGlobSetting();

export interface ShopProductCls extends TreeModel<ShopProductCls> {
  code?: string; // 系列编码
  name?: string; // 系列名称
  bappShow?: string; // 是否APP显示
  picUrl?: string; // APP图片路径
  fileId?: string; // APP文件ID
}

export const shopProductClsList = (params?: ShopProductCls | any) =>
  defHttp.get<ShopProductCls>({ url: adminPath + '/shop/product/shopProductCls/list', params });

export const shopProductClsListData = (params?: ShopProductCls | any) =>
  defHttp.post<ShopProductCls[]>({
    url: adminPath + '/shop/product/shopProductCls/listData',
    params,
  });

export const shopProductClsForm = (params?: ShopProductCls | any) =>
  defHttp.get<ShopProductCls>({ url: adminPath + '/shop/product/shopProductCls/form', params });

export const shopProductClsCreateNextNode = (params?: ShopProductCls | any) =>
  defHttp.get<ShopProductCls>({
    url: adminPath + '/shop/product/shopProductCls/createNextNode',
    params,
  });

export const shopProductClsSave = (params?: any, data?: ShopProductCls | any) =>
  defHttp.postJson<ShopProductCls>({
    url: adminPath + '/shop/product/shopProductCls/save',
    params,
    data,
  });

export const shopProductClsDisable = (params?: ShopProductCls | any) =>
  defHttp.get<ShopProductCls>({ url: adminPath + '/shop/product/shopProductCls/disable', params });

export const shopProductClsEnable = (params?: ShopProductCls | any) =>
  defHttp.get<ShopProductCls>({ url: adminPath + '/shop/product/shopProductCls/enable', params });

export const shopProductClsDelete = (params?: ShopProductCls | any) =>
  defHttp.get<ShopProductCls>({ url: adminPath + '/shop/product/shopProductCls/delete', params });

export const shopProductClsTreeData = (params?: any) =>
  defHttp.get<TreeDataModel[]>({
    url: adminPath + '/shop/product/shopProductCls/treeData',
    params,
  });

export const batchPublishToApp = (params?: any, data?: ShopProductCls | any) =>
  defHttp.postJson<ShopProductCls>({
    url: adminPath + '/shop/product/shopProductCls/batchPublishToApp',
    params,
    data,
  });

export const unPublishedToApp = (params?: any, data?: ShopProductCls | any) =>
  defHttp.postJson<ShopProductCls>({
    url: adminPath + '/shop/product/shopProductCls/unPublishedToApp',
    params,
    data,
  });
